<template>
  <main class="main-content">
    <div class="content-wrapper">
      <!-- 欢迎区域 -->
      <section class="welcome-section">
        <h2>欢迎回来，{{ userInfo.nickName || userInfo.email }}！</h2>
        <p class="text-muted">今天是美好的一天，开始您的聊天之旅吧</p>
      </section>

      <!-- 功能卡片网格 -->
      <section class="features-grid">
        <a-card 
          class="feature-card"
          @click="handleFeatureClick('chat')"
          hoverable
          :bordered="false"
        >
          <div class="feature-icon">
            <MessageOutlined />
          </div>
          <h3>开始聊天</h3>
          <p>与朋友和家人保持联系</p>
        </a-card>

        <a-card 
          class="feature-card"
          @click="handleFeatureClick('contacts')"
          hoverable
          :bordered="false"
        >
          <div class="feature-icon">
            <TeamOutlined />
          </div>
          <h3>联系人</h3>
          <p>管理您的联系人列表</p>
        </a-card>

        <a-card 
          class="feature-card"
          @click="handleFeatureClick('settings')"
          hoverable
          :bordered="false"
        >
          <div class="feature-icon">
            <SettingOutlined />
          </div>
          <h3>设置</h3>
          <p>个性化您的体验</p>
        </a-card>

        <a-card 
          class="feature-card"
          @click="handleFeatureClick('help')"
          hoverable
          :bordered="false"
        >
          <div class="feature-icon">
            <QuestionCircleOutlined />
          </div>
          <h3>帮助</h3>
          <p>获取使用帮助</p>
        </a-card>
      </section>
    </div>
  </main>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue'
import { MessageOutlined, TeamOutlined, SettingOutlined, QuestionCircleOutlined } from '@ant-design/icons-vue'
import { Card } from 'ant-design-vue'

// 定义props
interface UserInfo {
  nickName?: string
  email?: string
}

defineProps<{
  userInfo: UserInfo
}>()

// 定义emits
const emit = defineEmits<{
  featureClick: [feature: string]
}>()

const handleFeatureClick = (feature: string): void => {
  emit('featureClick', feature)
}
</script>

<style scoped>
.main-content {
  margin-top: 72px;
  min-height: calc(100vh - 72px);
  padding: 40px 32px;
}

.content-wrapper {
  max-width: 1600px;
  margin: 0 auto;
}

.welcome-section {
  text-align: center;
  margin-bottom: 64px;
  padding: 80px 40px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.welcome-section h2 {
  font-size: 42px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: #64748b;
  font-size: 20px;
  font-weight: 400;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 32px;
  margin-bottom: 64px;
}

.feature-card {
  text-align: center;
  padding: 48px 32px;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer;
  border: 2px solid transparent !important;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-12px) scale(1.02) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  border-color: #667eea !important;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  font-size: 64px;
  color: #667eea;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.feature-card h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #1e293b;
  position: relative;
  z-index: 1;
}

.feature-card p {
  color: #64748b;
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* 响应式设计 */
@media (max-width: 1400px) {
  .content-wrapper {
    max-width: 100%;
  }

  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 28px;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 24px 20px;
    margin-top: 64px;
  }

  .welcome-section {
    padding: 48px 24px;
    margin-bottom: 40px;
  }

  .welcome-section h2 {
    font-size: 28px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
  }
}
</style>